package com.neuedu.web.controller.system;

import java.util.List;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.neuedu.common.annotation.Log;
import com.neuedu.common.core.controller.BaseController;
import com.neuedu.common.core.domain.AjaxResult;
import com.neuedu.common.enums.BusinessType;
import com.neuedu.system.domain.AAAAYunongHouseholdInfo;
import com.neuedu.system.service.IAAAAYunongHouseholdInfoService;
import com.neuedu.common.utils.poi.ExcelUtil;
import com.neuedu.common.core.page.TableDataInfo;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

/**
 * 户主信息Controller
 *
 * @author ruoyi
 * @date 2024-12-18
 */
@RestController
@RequestMapping("/system/AAAAinfo")
@Tag(name = "【户主信息】管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AAAAYunongHouseholdInfoController extends BaseController
{
    private final IAAAAYunongHouseholdInfoService aAAAYunongHouseholdInfoService;

    /**
     * 查询户主信息列表
     */
    @Operation(summary = "查询户主信息列表")
    @PreAuthorize("@ss.hasPermi('system:AAAAinfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(AAAAYunongHouseholdInfo aAAAYunongHouseholdInfo)
    {
        startPage();
        List<AAAAYunongHouseholdInfo> list = aAAAYunongHouseholdInfoService.selectAAAAYunongHouseholdInfoList(aAAAYunongHouseholdInfo);
        return getDataTable(list);
    }

    /**
     * 导出户主信息列表
     */
    @Operation(summary = "导出户主信息列表")
    @PreAuthorize("@ss.hasPermi('system:AAAAinfo:export')")
    @Log(title = "户主信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AAAAYunongHouseholdInfo aAAAYunongHouseholdInfo)
    {
        List<AAAAYunongHouseholdInfo> list = aAAAYunongHouseholdInfoService.selectAAAAYunongHouseholdInfoList(aAAAYunongHouseholdInfo);
        ExcelUtil<AAAAYunongHouseholdInfo> util = new ExcelUtil<AAAAYunongHouseholdInfo>(AAAAYunongHouseholdInfo.class);
        util.exportExcel(response, list, "户主信息数据");
    }

    /**
     * 获取户主信息详细信息
     */
    @Operation(summary = "获取户主信息详细信息")
    @PreAuthorize("@ss.hasPermi('system:AAAAinfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(aAAAYunongHouseholdInfoService.selectAAAAYunongHouseholdInfoById(id));
    }

    /**
     * 新增户主信息
     */
    @Operation(summary = "新增户主信息")
    @PreAuthorize("@ss.hasPermi('system:AAAAinfo:add')")
    @Log(title = "户主信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AAAAYunongHouseholdInfo aAAAYunongHouseholdInfo)
    {
        return toAjax(aAAAYunongHouseholdInfoService.insertAAAAYunongHouseholdInfo(aAAAYunongHouseholdInfo));
    }

    /**
     * 修改户主信息
     */
    @Operation(summary = "修改户主信息")
    @PreAuthorize("@ss.hasPermi('system:AAAAinfo:edit')")
    @Log(title = "户主信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AAAAYunongHouseholdInfo aAAAYunongHouseholdInfo)
    {
        return toAjax(aAAAYunongHouseholdInfoService.updateAAAAYunongHouseholdInfo(aAAAYunongHouseholdInfo));
    }

    /**
     * 删除户主信息
     */
    @Operation(summary = "删除户主信息")
    @PreAuthorize("@ss.hasPermi('system:AAAAinfo:remove')")
    @Log(title = "户主信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable( name = "ids" ) Long[] ids)
    {
        return toAjax(aAAAYunongHouseholdInfoService.deleteAAAAYunongHouseholdInfoByIds(ids));
    }
}
